import Vue from 'vue'
import Vuex from 'vuex'
import app from './module/app'
import user from './module/user'

Vue.use(Vuex)

let state = {
  user: null,
  token: ''
}

export default new Vuex.Store({
  state,
  mutations: {
    showTopicTemplateUrl (state, url) {
      state.topicTemplateUrl = url
    },
    showTopicPage (state, obj = {}) {
      state.currentTopic = {
        ...state.currentTopic,
        ...obj
      }
    }
  },
  modules: {
    app,
    user
  }
})
